package ModelLayer;
/**
 * Dette er class Loan som opretter objektet lån.
 * 
 * @author (Frederik, Simon, Claus, Minh, Nichlas & Nicolai) 
 * @version (a version number or a date)
 */
public class Loan
{
    // instance variables - replace the example below with your own
    private String id;
    private String borrowDate;
    private int period;
    private Copy copy;
    private boolean isReturned;
    private boolean tooLate;

    /**
     * Constructor for objects of class Loan
     * @param id setter id for nyoprettet lån
     * @param copy setter copy
     * @param period setter period 
     * @param isReturned sættes til false for at blive ændret når kopien er retuneret og lånet ophøres
     * 
     */
    public Loan(String id, Copy copy,String borrowDate, int period)
    {
        // initialise instance variables
        this.id = id;
        this.copy = copy;
        this.period = period;
        isReturned = false;
        tooLate = false;

    }

    public void setTooLate(boolean tooLate)
    {
        this.tooLate = tooLate;
    }

    public boolean getTooLate()
    {
        return tooLate;
    }
    
    public void setIsReturn(boolean bool)
    {
        isReturned = bool;
    }

    public boolean getIsReturn()
    {
        return isReturned;
    }

    public String getId()
    {
        return id;
    }

    public void setId(String id)
    {
        this.id = id;
    }

    public String getBorrowDate()
    {
        return borrowDate;
    }

    public Copy getCopy()
    {
        return copy;
    }
    
    public void printInfo()
    {
        System.out.println("Loan information:");
        System.out.println("Id: " + getId());
        System.out.println("Has been returned: " + getIsReturn());
        System.out.println("Late: " + getTooLate());
        System.out.println("The borrowed copy is:");
        copy.printInfo();
    }
}